projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
272611d
)
luci-base: dispatcher.lua: support "absent" fs dependency for menu nodes
author
Jo-Philipp Wich
<
[email protected]
>
Wed, 27 Apr 2022 11:13:12 +0000
(13:13 +0200)
committer
Jo-Philipp Wich
<
[email protected]
>
Fri, 20 May 2022 18:23:26 +0000
(20:23 +0200)
The "absent" dependency type requires the given path to not exist on the
local system for the condition to be satisified. This is useful to disable
menu nodes depending on the presence of specific files.
Signed-off-by: Jo-Philipp Wich <
[email protected]
>
(cherry picked from commit
2e4b5fb8ff2fb3bfd1400bf7cbf721057f02fab9
)
modules/luci-base/luasrc/dispatcher.lua
patch
|
blob
|
history
diff --git
a/modules/luci-base/luasrc/dispatcher.lua
b/modules/luci-base/luasrc/dispatcher.lua
index e286430765be69df5739c7e2bc5e44e3bfc60eba..d27af0755afd6ea9e7760e048c2c5b66a6aebd27 100644
(file)
--- a/
modules/luci-base/luasrc/dispatcher.lua
+++ b/
modules/luci-base/luasrc/dispatcher.lua
@@
-39,6
+39,10
@@
local function check_fs_depends(spec)
if fs.stat(path, "type") ~= "reg" then
return false
end
+ elseif kind == "absent" then
+ if fs.stat(path, "type") then
+ return false
+ end
end
end